package com.itbaizhan.shopping_category_customer_api.controller;

/**
 * @author spf
 * @date 2023/12/28
 * @time 15:18
 */

import com.itbaizhan.shopping_common.pojo.Category;
import com.itbaizhan.shopping_common.result.BaseResult;
import com.itbaizhan.shopping_common.service.CategoryService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 广告服务API控制器
 */
@RestController
@RequestMapping("/user/category")
public class CategoryController {

    @Reference(loadbalance = "roundrobin")
    private CategoryService categoryService;

    /**
     * 前台获取全部启用的广告
     * @return 执行结果
     */
    @GetMapping("/all")
    public BaseResult<List<Category>> findAll(){
        List<Category> categoryList = categoryService.findAll();
        return BaseResult.ok(categoryList);
    }

}
